home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / pcmagwin.zip / DATEDI.XLM (.txt) < prev    next >
Excel Spreadsheet  |  1992-12-02  |  5KB  |  64 lines

  1. Sheet: 
  2. (0, 0)        
  3. (0, 1)        DateDiff (custom function; enter as 3-cell horizontal array)
  4. (1, 0)        
  5. (1, 1)        
  6. (1, 2)        
  7. (2, 0)        
  8. (2, 1)        TRUE
  9. (2, 2)        Make the function return an array
  10. (3, 0)        
  11. (3, 1)        TRUE
  12. (3, 2)        Get earlier date
  13. (4, 0)        
  14. (4, 1)        TRUE
  15. (4, 2)        Get later date
  16. (5, 0)        Day1
  17. (5, 1)        25
  18. (5, 2)        Parse both dates into d-m-y
  19. (6, 0)        Month1
  20. (6, 1)        9
  21. (6, 2)           components
  22. (7, 0)        Year1
  23. (7, 1)        1989
  24. (8, 0)        Day2
  25. (8, 1)        52
  26. (9, 0)        Month2
  27. (9, 1)        18
  28. (10, 0)        Year2
  29. (10, 1)        1991
  30. (11, 0)        
  31. (11, 1)        TRUE
  32. (11, 2)        If we need to carry the day value...
  33. (12, 0)        
  34. (12, 1)        TRUE
  35. (12, 2)            Add appropriate value to Day2
  36. (13, 0)        
  37. (13, 1)        TRUE
  38. (13, 2)            And subtract 1 from Month2
  39. (14, 0)        
  40. (14, 1)        TRUE
  41. (15, 0)        
  42. (15, 1)        TRUE
  43. (15, 2)        If we need to carry the month value...
  44. (16, 0)        
  45. (16, 1)        TRUE
  46. (16, 2)           Add 12 to Month2
  47. (17, 0)        
  48. (17, 1)        TRUE
  49. (17, 2)           And subtract 1 from Year2
  50. (18, 0)        
  51. (18, 1)        TRUE
  52. (19, 0)        ResultArray
  53. (19, 1)        2
  54. (19, 2)        Get year component of result
  55. (20, 0)        
  56. (20, 1)        9
  57. (20, 2)        Get month component of result
  58. (21, 0)        
  59. (21, 1)        27
  60. (21, 2)        Get day component of result
  61. (22, 0)        
  62. (22, 1)        TRUE
  63. (22, 2)        And return as a horizontal array
  64.